#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
爬虫启动入口
"""

import sys
import os

# 将项目根目录添加到Python路径
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

import logging

# 配置日志
logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s - %(levelname)s - %(message)s'
)

# 导入调度器
from news_crawler.scheduler import Scheduler

if __name__ == "__main__":
    try:
        logging.info("开始启动爬虫调度器...")
        scheduler = Scheduler()
        scheduler.run()
    except Exception as e:
        logging.error(f"启动失败: {str(e)}")
        import traceback
        logging.error(traceback.format_exc()) 